Initial positions are set to 0 causing sudden movement#67
Initial positions are set to 0 causing sudden movement#67daniel-kovari wants to merge 4 commits into
Conversation
|
Will test on the hardware!! Thanks |
ggorjup
left a comment
There was a problem hiding this comment.
I tested this on real hardware and it seems to work fine.
In case it's useful, I'm suggesting a couple of simplifications.
There was a problem hiding this comment.
Thanks for the work!
Could v10_hardware.cpp go into a separate PR? This looks unrelated to the zero-position issue.
There was a problem hiding this comment.
Hi, I cleaned up the PR. I moved the changes for gravity compensation onto another feature branch: https://github.com/Kovari-Industries/openarm_ros2/tree/feat/gravity-compensation. It is using a KDL chain and implying the urdf from the controller manager - HardwareInfo::original_xml. This works for me and makes the controls much smoother. If this is a valid implementation, I can put that up as a separate PR.
There was a problem hiding this comment.
Thanks for splitting that out. It's much cleaner to review now.
Gravity compensation is something we're interested in as well, so please feel free to open it as a separate PR.
We can discuss the design (KDL chain, reading URDF via HardwareInfo::original_xml, etc.) over there.
Co-authored-by: Gal Gorjup <gorjup.gal@gmail.com>
| "Setting current position..."); | ||
|
|
||
| // Use read() to populate state arrays | ||
| read(rclcpp::Time(), rclcpp::Duration(0, 0)); |
There was a problem hiding this comment.
What if CAN communication fails? Won't pos_states_ be left holding a stale or default value after read()?
Would it make sense to add a safety check?
on_activate()에서 return_to_zero() 대신 set_current_pose()를 호출하여 활성화 시 현재 위치를 커맨드 초기값으로 설정함 기존 return_to_zero(): - 모든 관절을 position=0.0 으로 MIT 제어 - 어떤 자세에 있든 활성화 순간 0 rad로 강제 이동 → 갑작스럽고 위험한 움직임 수정 set_current_pose(): - read()로 현재 모터 상태를 읽음 - 현재 위치를 커맨드 초기값으로 설정 (pos_commands_[i] = pos_states_[i]) - 활성화 순간 움직임 없음 → 이후 trajectory 명령부터 부드럽게 시작 참고: enactic#67
Fixes #66